
*************************************** Baseline Data *************************************************

use "$folder/data/input/Klarner_2015.dta", clear

keep if quar==2.5

keep statename stateabrev year pop pop_a cpinat cpinat_a cpireg cpireg_a inc inc_a gsp-revpinc

drop if statename == "District of Columbia"
drop if statename == "Far West"
drop if statename == "Great Lakes"
drop if statename == "Mideast"
drop if statename == "New England"
drop if statename == "Plains"
drop if statename == "Rocky Mountain"
drop if statename == "Southeast"
drop if statename == "Southwest"
drop if statename == "United States"

gen biennium =  year + mod(year,2)
replace year = biennium

collapse (mean) pop-revpinc, by(statename stateabrev year)

sort stateabrev year
egen state=group(stateabrev)
order statename state stateabrev year pop-revpinc
xtset state year, yearly delta(2)

* Generating Economic Variables
gen log_gsp_a = log(gsp_a)
gen log_gsp_a_D = D.log_gsp_a
gen growth_gsp = log_gsp_a_D   
gen L_growth = L.growth

gen log_unemp=log(unemploy_a)
gen unemp_D=D.log_unemp

gen log_real1gsppc = log(real1gsppc)
gen growth_pc = D.log_real1gsppc
gen L_growth_pc = L.growth_pc


gen lpop = log(pop_a)
gen lpop2 = lpop^2
gen lpop_D = D.lpop
gen growth_pop = lpop_D 

* Given data: we are using until 64-66 as "pretreatment" (Gsp begins in 1964)
bys state (year): gen growth_initial = growth_gsp[19] 
bys state (year): gen gsp_initial =log_gsp_a[19]
bys state (year): gen unemp_D_initial = unemp_D[19] 
bys state (year): gen growth_gsp_pc_initial =unemp_D[19]
bys state (year): gen gsp_pc_initial =log_real1gsppc[19]
bys state (year): gen unemp_initial =log_unemp[19]


save econ_data, replace
